/**
 * 2019年2月17日下午1:06:52
 * @author 谢进财
 */
package com.baihang.project.ds.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baihang.framework.controller.BaseController;
import com.baihang.project.ds.service.MySqlRedisService;

/**
 * mysql与redis数据交换
 *
 */
@Controller
@RequestMapping("/MySqlRedis")
public class MySqlRedisController extends BaseController {
	private static Logger logger = LoggerFactory.getLogger(MySqlRedisController.class);
	@Autowired
	private MySqlRedisService service;
	
	//项目开始后  将mysql中的相关数据更新到redis
	@RequestMapping(value ="/startFromMysqlToRedis", produces="application/json;charset=UTF-8")
	@ResponseBody
	public String startFromMysqlToRedis() {
		logger.info("项目启动mysql同步到redis");
		String json = service.startFromMysqlToRedis();
		return json;
	}
	
	//项目结束后  将redis中的相关数据更新到mysql
	@RequestMapping(value ="/overFromRedisToMysql", produces="application/json;charset=UTF-8")
	@ResponseBody
	public String overFromRedisToMysql() {
		logger.info("项目结束redis同步到mysql");
		String json = service.overFromRedisToMysql();
		return json;
	}
	
	
	
}
